﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Print
{
    public partial class OpenForm : Form
    {
        public OpenForm()
        {
            InitializeComponent();
            this.buttonX1.DialogResult = DialogResult.OK;
            this.buttonX2.DialogResult = DialogResult.Cancel;
            this.buttonX1.Enabled = false;
        }

        private void OpenForm_Load(object sender, EventArgs e)
        {
            this.Text = "打开报表模板";
        }

        //填充ListView模板
        public DataTable ReportTable
        {
            set
            {
                foreach (DataRow dr in value.Rows)
                {
                    //找到XML文件中的ReportName节点，用报表模板的名称填充ListView控件
                    listBox1.Items.Add(dr["ReportName"].ToString());
                }
            }
        }

        //选择模板名称
        public string SelectedReportName
        {
            get
            {
                return listBox1.SelectedItem.ToString();
            }
        }

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            buttonX1.Enabled = listBox1.SelectedIndex != -1;
        }

        private void buttonX1_Click(object sender, EventArgs e)
        {

        }
    }
}
